package com.jspxcms.plug.repository.impl;

import com.jspxcms.plug.domain.UserExchange;
import com.jspxcms.plug.repository.UserExchangeDaoPlus;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import java.util.List;

/**
 * Created by yuanyue on 14-10-5.
 */
public class UserExchangeDaoImpl implements UserExchangeDaoPlus {
    @Override
    public void update(UserExchange bean) {
        Query query = em.createNativeQuery("update plug_user_exchange\n" +
                "set f_success = " + bean.getSuccess() + "\n" +
                "where f_id =  " + bean.getId());
        query.executeUpdate();
    }

    private EntityManager em;

    @PersistenceContext
    public void setEm(EntityManager em) {
        this.em = em;
    }
}
